﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading;

public static class JsonNetExtension
{
    [DebuggerHidden]
    public static IEnumerable<JToken> DeepChildren(this JToken token)
    {
        return new <DeepChildren>c__IteratorE { token = token, <$>token = token, $PC = -2 };
    }

    [CompilerGenerated]
    private sealed class <DeepChildren>c__IteratorE : IDisposable, IEnumerator, IEnumerable, IEnumerator<JToken>, IEnumerable<JToken>
    {
        internal JToken $current;
        internal int $PC;
        internal JToken <$>token;
        internal IEnumerator<JToken> <$s_94>__0;
        internal IEnumerator<JToken> <$s_95>__2;
        internal JToken <child>__1;
        internal JToken <deepChild>__3;
        internal JToken token;

        [DebuggerHidden]
        public void Dispose()
        {
            uint num = (uint) this.$PC;
            this.$PC = -1;
            switch (num)
            {
                case 1:
                case 2:
                    try
                    {
                        switch (num)
                        {
                            case 2:
                                try
                                {
                                }
                                finally
                                {
                                    if (this.<$s_95>__2 == null)
                                    {
                                    }
                                    this.<$s_95>__2.Dispose();
                                }
                                return;
                        }
                    }
                    finally
                    {
                        if (this.<$s_94>__0 == null)
                        {
                        }
                        this.<$s_94>__0.Dispose();
                    }
                    break;
            }
        }

        public bool MoveNext()
        {
            uint num = (uint) this.$PC;
            this.$PC = -1;
            bool flag = false;
            switch (num)
            {
                case 0:
                    this.<$s_94>__0 = this.token.Children().GetEnumerator();
                    num = 0xfffffffd;
                    break;

                case 1:
                case 2:
                    break;

                default:
                    goto Label_013B;
            }
            try
            {
                switch (num)
                {
                    case 1:
                        this.<$s_95>__2 = this.<child>__1.DeepChildren().GetEnumerator();
                        num = 0xfffffffd;
                        goto Label_009C;

                    case 2:
                        goto Label_009C;
                }
                while (this.<$s_94>__0.MoveNext())
                {
                    this.<child>__1 = this.<$s_94>__0.Current;
                    this.$current = this.<child>__1;
                    this.$PC = 1;
                    flag = true;
                    goto Label_013D;
                Label_009C:
                    try
                    {
                        while (this.<$s_95>__2.MoveNext())
                        {
                            this.<deepChild>__3 = this.<$s_95>__2.Current;
                            this.$current = this.<deepChild>__3;
                            this.$PC = 2;
                            flag = true;
                            goto Label_013D;
                        }
                    }
                    finally
                    {
                        if (!flag)
                        {
                        }
                        if (this.<$s_95>__2 == null)
                        {
                        }
                        this.<$s_95>__2.Dispose();
                    }
                }
            }
            finally
            {
                if (!flag)
                {
                }
                if (this.<$s_94>__0 == null)
                {
                }
                this.<$s_94>__0.Dispose();
            }
            this.$PC = -1;
        Label_013B:
            return false;
        Label_013D:
            return true;
        }

        [DebuggerHidden]
        public void Reset()
        {
            throw new NotSupportedException();
        }

        [DebuggerHidden]
        IEnumerator<JToken> IEnumerable<JToken>.GetEnumerator()
        {
            if (Interlocked.CompareExchange(ref this.$PC, 0, -2) == -2)
            {
                return this;
            }
            return new JsonNetExtension.<DeepChildren>c__IteratorE { token = this.<$>token };
        }

        [DebuggerHidden]
        IEnumerator IEnumerable.GetEnumerator()
        {
            return this.System.Collections.Generic.IEnumerable<Newtonsoft.Json.Linq.JToken>.GetEnumerator();
        }

        JToken IEnumerator<JToken>.Current
        {
            [DebuggerHidden]
            get
            {
                return this.$current;
            }
        }

        object IEnumerator.Current
        {
            [DebuggerHidden]
            get
            {
                return this.$current;
            }
        }
    }
}

